package com.jiutong.meipengdai.http.present;

import android.content.Context;

import com.jiutong.meipengdai.http.model.requests.CommonRequest;
import com.jiutong.meipengdai.http.subscribers.ProgressSubscriber;
import com.jiutong.meipengdai.http.subscribers.SubscriberOnNextListener;

import java.util.HashMap;

/**
 * 作用:
 * Created by 78 on 2017/7/6.
 */

public class CommonPresent {

    /**
     * 市区列表
     */
    public static void getAreaDate(Context context, SubscriberOnNextListener onNextListener, HashMap<String, Object> fieldsMap) {

        CommonRequest commonRequest = new CommonRequest();
        commonRequest.getAreaDate(new ProgressSubscriber(onNextListener, context), fieldsMap);
    }

    /**
     * 评估结果
     */
    public static void getEvaluateResult(Context context, SubscriberOnNextListener onNextListener, HashMap<String, Object> fieldsMap) {

        CommonRequest commonRequest = new CommonRequest();
        commonRequest.getEvaluateResult(new ProgressSubscriber(onNextListener, context), fieldsMap);
    }

    /**
     * 还款计划
     */
    public static void getRepayPlan(Context context, SubscriberOnNextListener onNextListener, HashMap<String, Object> fieldsMap) {
        CommonRequest commonRequest = new CommonRequest();
        commonRequest.getRepayPlan(new ProgressSubscriber(onNextListener, context), fieldsMap);
    }


    /**
     * 房产详情
     */
    public static void getHouseDetial(Context context, SubscriberOnNextListener onNextListener, HashMap<String, Object> fieldsMap) {
        CommonRequest commonRequest = new CommonRequest();
        commonRequest.getHouseDetial(new ProgressSubscriber(onNextListener, context), fieldsMap);
    }

    /**
     * 银行卡检测
     */
    public static void checkBankCard(Context context, SubscriberOnNextListener onNextListener, HashMap<String, Object> fieldsMap) {
        CommonRequest commonRequest = new CommonRequest();
        commonRequest.checkBankCard(new ProgressSubscriber(onNextListener, context), fieldsMap);
    }

    /**
     * 银行卡绑定
     */
    public static void bankCardBinding(Context context, SubscriberOnNextListener onNextListener, HashMap<String, Object> fieldsMap) {
        CommonRequest commonRequest = new CommonRequest();
        commonRequest.bankCardBinding(new ProgressSubscriber(onNextListener, context), fieldsMap);
    }

    /**
     * 获取城市列表
     */
    public static void getCityData(Context context, SubscriberOnNextListener onNextListener, HashMap<String, Object> fieldsMap) {
        if(fieldsMap == null)
            fieldsMap = new HashMap<>();

        CommonRequest commonRequest = new CommonRequest();
        commonRequest.getCityData(new ProgressSubscriber(onNextListener, context), fieldsMap);
    }

    /**
     * 获取区、街道、小区
     */
    public static void getAreaAndStreedList(Context context, SubscriberOnNextListener onNextListener, HashMap<String, Object> fieldsMap) {
        if(fieldsMap == null)
            fieldsMap = new HashMap<>();

        CommonRequest commonRequest = new CommonRequest();
        commonRequest.getAreaAndStreedList(new ProgressSubscriber(onNextListener, context), fieldsMap);
    }

    /**
     * 获取补丁
     */
    public static void getPatch(Context context, SubscriberOnNextListener onNextListener, HashMap<String, Object> fieldsMap) {
        if(fieldsMap == null)
            fieldsMap = new HashMap<>();

        CommonRequest commonRequest = new CommonRequest();
        commonRequest.getPatch(new ProgressSubscriber(onNextListener, context), fieldsMap);
    }

    /**
     * 上传异常信息
     */
    public static void pushCrash(Context context, SubscriberOnNextListener onNextListener, HashMap<String, Object> fieldsMap) {
        if(fieldsMap == null)
            fieldsMap = new HashMap<>();

        CommonRequest commonRequest = new CommonRequest();
        commonRequest.pushCrash(new ProgressSubscriber(onNextListener, context), fieldsMap);
    }
}
